package com.wdb007.venus.svc.biz.qrcode.utils;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class ImageMergeUtil {

	public static void merge(String bgPath, String qrcodePath, String visitorPath) {
		try {
			BufferedImage img = new BufferedImage(638, 920, BufferedImage.TYPE_INT_RGB);//创建图片
			
			BufferedImage bg = ImageIO.read(new File(bgPath));
			BufferedImage qrCode = ImageIO.read(new File(qrcodePath));
			
			Graphics g = img.getGraphics();//开启画图
			g.drawImage(bg, 0, 0, null);
			g.drawImage(qrCode, 230, 655, null);
			g.dispose();
			ImageIO.write(img, "jpg", new File(visitorPath));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
